<?php
/**
 * Created by PhpStorm.
 * User: leo
 * Date: 2018/5/14
 * Time: 15:57
 */
session_start();
$num=$_POST['num'];
include '../classes/conn.php';
if(isset($_SESSION['admin_num'])) {
    $query="select num from teacher where num='{$num}'";
    $res=mysql_query($query);
    if(mysql_num_rows($res)){
        $psw=md5(substr($num, -6));
        $query="update teacher set psw ='{$psw}' where num='{$num}'";
        mysql_query($query);
        echo '1';
        mysql_close($conn);
    }
    else die('no_exist');

}
else echo "no_login";